package model.turtle;

import java.awt.Color;
import java.awt.Graphics;
import util.Pixmap;


/**
 * An entity whose state can be changed after a Command
 *      is applied to it.
 *
 * @author Erick Gonzalez & Matthew Roy
 */
public interface Commandable {

    /**
     * constant for a solid pen design.
     */
    String SOLID_LINE_PATTERN = "solid";
    /**
     * constant for a dashed pen design.
     */
    String DASHED_LINE_PATTERN = "dashed";
    /**
     * constant for list of pen design choices.
     */
    String[] LINE_DESIGN_CHOICES = {SOLID_LINE_PATTERN, DASHED_LINE_PATTERN};

    /**
     * Clears the stamps from the Commandable's path.
     */
    int clearStamps();

    /**
     * Sets the heading of the Commandable object.
     * @return the heading
     */
    int getHeading();

    /**
     * Gets the Commandable's ID.
     * @return the ID
     */
    int getID();

    /**
     * gets the Commandable's image.
     * @return Pixmap image
     */
    Pixmap getImage();

    /**
     * Returns the color of the Commandable's pen.
     * @return the Color of the pen
     */
    int getPenColor();

    /**
     * Gets the state of the Commandable's pen.
     * @return 1 if down, 0 if up
     */
    int getPenState();

    /**
     * Gets the state of the Commandable's visibilty.
     * @return 1 if visible, 0 if not visible
     */
    int getVisibility();

    /**
     * Gets the x-coordinate of the Commandable object.
     * @return the x-coordinate
     */
    int getXCoordinate();

    /**
     * Gets the y-coordinate of the Commandable object.
     * @return the y-coordinate
     */
    int getYCoordinate();

    /**
     * Gets whether the Commandable object is active or inactive.
     * @return true if active, false if inactive
     */
    int isActive();

    /**
     * Makes the entity invisible.
     */
    int makeInvisible();

    /**
     * Makes the entity visible.
     */
    int makeVisible();

    /**
     * Moves the entity by the given number of pixels.
     *
     * @param pixels pixels to move entity by. A positive argument moves the
     *        entity forward, a
     *        negative
     *        argument moves the entity backwards.
     */
    int move(int pixels);

    /**
     * Paints the entity.
     *
     * @param pen is the graphics
     */
    int paint(Graphics pen);

    /**
     * paints a box around active commandables
     * @param pen 
     * @return 1 if highlight painted, 0 otherwise
     */
    int paintHighlight(Graphics pen);

    /**
     * Erases the entity's trails and sends it to the home position.
     */
    void clear();

    /**
     * Rotates the entity by the given number of degrees.
     *
     * @param degrees degrees to rotate the entity by. A positive argument
     *        rotates the entity
     *        clockwise,
     *        a negative argument rotates the entity counter-clockwise.
     */
    int rotate(int degrees);

    /**
     * Sets the Commandable's active state.
     * @param state if state is true, then sets on
     * @return returns the active state: 1 if on, 0 if off
     */
    int setActiveState(boolean state);

    /**
     * Turns entity to an absolute heading.
     *
     * @param heading the angle that entity will make measured counter-clockwise
     *        from the x-axis.
     */
    int setHeading(int heading);

    /**
     * 
     * @param x the x coordinate of the point to turn towards
     * @param y the y coordinate of the point to turn towards
     * @return
     */
    int setTowards(int x, int y);

    /**
     * sets the commandable's image.
     * @param image 
     */
    int setImage(Pixmap image);

    /**
     * Sets pen color to c.
     * @param c is new color
     */
    int setPenColor(Color c);

    /**
     * sets the path design.
     *
     * @param design is solid, dashed, etc
     */
    int setPenDesign(String design);

    /**
     * Puts pen down such that when the entity moves, it does not leave a trail.
     */
    int setPenDown();

    /**
     * Puts pen up such that when the entity moves, it leaves a trail.
     */
    int setPenUp();

    /**
     * Sets the width of the path line.
     * @param width 
     */
    int setPenSize(int width);

    /**
     * Set the position of this entity.
     *
     * @param x the new x-coordinate
     * @param y the new y-coordinate
     */
    int setPosition(int x, int y);

    /**
     * Stamps the Commandable's image to its path.
     */
    int stamp();
}
